package alo;

import com.sun.xml.internal.ws.binding.FeatureListUtil;

import java.util.*;

/**
 * @ClassName t4
 * @Description TODO
 * @Author Fanxc
 * @DATE 2021/4/20 9:25
 * @Version 1.0
 */
public class t4 {
    static class Node{
        int key, val;
        public Node(int key, int val) {
            this.key = key;
            this.val = val;
        }
    }
    public static void test(int k){
        TreeSet<Node> set=new TreeSet<>(
                new Comparator<Node>() {
                    @Override
                    public int compare(Node t1, Node t2) {
                        return t2.val- t1.val;
                    }
                }
        );
        List<Node> list=new LinkedList<>();
        HashMap<Integer,Node> map=new HashMap<>();
        for (int i = 0; i < 3; i++) {
            Node node = new Node(i, i);
            //set.add(node);
            list.add(node);
            map.put(i,node);
        }
        for (Node node:
             list) {
            System.out.println(node.val);
        }
        System.out.println();
        if (map.containsKey(k)){
            Node node = map.get(k);
            node.val+=10;
            list.remove(k);
            list.add(node);
            //set.add(node);
        }
        Collections.sort(list, new Comparator<Node>() {
            @Override
            public int compare(Node t1, Node t2) {
                return t1.val- t2.val;
            }
        });
        for (Node node:
                list) {
            System.out.println(node.val);
        }

    }

    public static void main(String[] args) {
        test(1);
    }
}
